#!/usr/bin/python3

from baseSql import *

class CSystemVersion:
    tableTitle = ["版本号", "版本类型"]
    def __init__(self):
        self.version = [self.tableTitle]

    def init(self, db):
        self.db = db
        self.reload()

    def reload(self):
        self.version = [self.tableTitle]
        self.db.query(queryAllTableSql + t_system_version)
        datas = self.db.getData()
        for data in datas:
            self.version.append([data[0], data[1]])


    def add(self, user, version, versionType):
        sql = "insert " + t_system_version + "(version, version_type) valuse( " + version + "," + versionType + " ) "
        execDBData(dbConnPool=self.db, user=user, doSql=sql, msg="add vsesion")
